﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using DAL;
using BLL;

public partial class ERDS_QTJLZB : System.Web.UI.Page
{
    BLL.BLLEeds br = new BLLEeds();
    string strApp = "";
    string errMsg = "";

    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            DateTime dt = System.DateTime.Now;
            this.DateStart.Value = dt.AddDays(-1).ToString("yyyy-MM-dd");
            this.DateEnd.Value = dt.AddDays(-1).ToString("yyyy-MM-dd");
            string JZ = "";

            if (this.DDLJZ.SelectedValue == "JZ1")
            {
                JZ = "1";
            }
            else if (this.DDLJZ.SelectedValue == "JZ2")
            {
                JZ = "2";
            }
            else if (this.DDLJZ.SelectedValue == "JZ3")
            {
                JZ = "3";
            }
            else if (this.DDLJZ.SelectedValue == "JZ4")
            {
                JZ = "4";
            }

            ArrayList list = br.SelectSBNM(JZ, out errMsg);

            string[] val1 = (string[])list[0];
            for (int i = 0; i < val1.Length; i++)
            {
                if (val1[i] != null)
                {
                    this.DDLZB.Items.Add(val1[i]);
                }
                else
                {
                    continue;
                }
            }
            //strApp = br.RetQTJL(DateTime.Parse(this.DateLR.Value).ToString("yyyy-MM-dd"), JZ,out errMsg);
            //this.show.InnerHtml = strApp;
        }
    }
    protected void LRBRQ_Click(object sender, EventArgs e)
    {
        string JZ = "";

        if (this.DDLJZ.SelectedValue == "JZ1")
        {
            JZ = "1";
        }
        else if (this.DDLJZ.SelectedValue == "JZ2")
        {
            JZ = "2";
        }
        else if (this.DDLJZ.SelectedValue == "JZ3")
        {
            JZ = "3";
        }
        else if (this.DDLJZ.SelectedValue == "JZ4")
        {
            JZ = "4";
        }

        string SB = this.DDLZB.SelectedValue.ToString();

        string SBID = br.SelectSBID(JZ,SB,out errMsg);

        string dateS = DateTime.Parse(this.DateStart.Value).ToString("yyyy-MM-dd");
        string dateE = DateTime.Parse(this.DateEnd.Value).ToString("yyyy-MM-dd");

        if (dateS == "" || dateE == "")
        {
        }
        else
        {
            strApp = br.RetQTJLZB(dateS, dateE, JZ, SBID, SB, out errMsg);
            this.show.InnerHtml = strApp;
        }
    }

    protected void DDLJZ_OnSelectedIndexChanged(object sender, EventArgs e)
    {
        string JZ = "";

        if (this.DDLJZ.SelectedValue == "JZ1")
        {
            JZ = "1";
        }
        else if (this.DDLJZ.SelectedValue == "JZ2")
        {
            JZ = "2";
        }
        else if (this.DDLJZ.SelectedValue == "JZ3")
        {
            JZ = "3";
        }
        else if (this.DDLJZ.SelectedValue == "JZ4")
        {
            JZ = "4";
        }

        ArrayList list = br.SelectSBNM(JZ, out errMsg);

        string[] val1 = (string[])list[0];
        for (int i = 0; i < val1.Length; i++)
        {
            if (val1[i] != null)
            {
                this.DDLZB.Items.Add(val1[i]);
            }
            else
            {
                continue;
            }
        }
    }
}
